home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / RTPC10 / NO_MD_RD.ASM < prev    next >
Assembly Source File  |  1993-11-20  |  5KB  |  131 lines

  1. ;---------------------------------------------------------------------------
  2. ;- NO_MD_RD.ASM    By Rafe Aldridge. Copyright (C) 1993 by Rafe Aldridge   -
  3. ;---------------------------------------------------------------------------
  4. ;- ??? : A TSR (terminate and stay resident) program that disables the     -
  5. ;-       create and remove subdirectory DOS functions. Any attempt by DOS  -
  6. ;-       or an application program to create or remove a subdirectory will -
  7. ;-       be suppressed and replaced by a beep.                             -
  8. ;---------------------------------------------------------------------------
  9. ;
  10. ; ┌───────────────────────────────────────────────────────────────┐
  11. ; │ Rafe's TP Collection is SHAREWARE                             │
  12. ; ├───────────────────────────────────────────────────────────────┤
  13. ; │                                                               │
  14. ; │ If you find any part of Rafe's TP Collection usefull then     │
  15. ; │ please become a registered user by sending 10 Pounds Sterling │
  16. ; │ to the address below. In return you will recieve the LATEST   │
  17. ; │ FULL source code to ALL the units as well anything new.       │
  18. ; │                                                               │
  19. ; │ Please feel free to write with suggestions, ideas or money to │
  20. ; │     Rafe Aldridge,                                            │
  21. ; │     Street Farm,                                              │
  22. ; │     Dereham Road,                                             │
  23. ; │     Garvestone,                                               │
  24. ; │     Norfolk.                                                  │
  25. ; │     NR9 4QT                                                   │
  26. ; │     ENGLAND                                                   │
  27. ; │                                                               │
  28. ; └───────────────────────────────────────────────────────────────┘
  29. ;
  30. ;- Compile : Using TASM ver 3.2 and TLINK 5.1                              -
  31. ;-           Type TASM NO_MD_RD [return]                                   -
  32. ;-                TLINK /t NO_MD_RD [return]                               -
  33. ;-           Will also compile with A86                                    -
  34. ;-           Should compile using MASM, LINK and EXE2BIN                   -
  35. ;---------------------------------------------------------------------------
  36. ;- Usage : Simply type NO_MD_RD at the DOS prompt. NOTE: this program does -
  37. ;-         not check to see if it already exists in memory and WILL        -
  38. ;-         install twice.                                                  -
  39. ;---------------------------------------------------------------------------
  40.  
  41. ; set up assembler
  42.  
  43.   .8086
  44.   .radix 16
  45.     page ,80
  46.   code segment para public 'code'
  47.   assume cs:code,ds:code,es:code,ss:code
  48.   org 100
  49.  
  50. ; start of resident portion of TSR
  51.  
  52. start:
  53.   jmp install
  54.  
  55. ; jump to old DOS ISR
  56.  
  57. old_dos:       db 0eah ; jump instruction
  58. old_dos_off    dw 0    ; address will be stored here
  59. old_dos_seg    dw 0
  60.  
  61. new_dos:
  62.  
  63. ; check function to see if it is an MD or RD function
  64.  
  65.   cmp ah,39h ; check to see if it is MD
  66.   je beep    ; it's MD so redefine function to be a beep
  67.  
  68.   cmp ah,3ah   ; check to see if it is RD
  69.   jne dos_exit ; it's not RD or MD so don't touch
  70.  
  71. beep:
  72.   mov ah,02 ; replace function with function to beep
  73.   mov dl,07
  74.  
  75. dos_exit:
  76.   jmp old_dos ; call the old dos routine
  77.  
  78. tsr_end         db 0 ; marks the end of the TSR resident portion
  79.  
  80. ; TSR Transient portion
  81.  
  82. install:
  83.  
  84. ; get old ISR address for interrupt 21h
  85.  
  86.   mov ax,3521h
  87.   int 21h
  88.   mov cs:[old_dos_off],bx ; store ISR address in jump statement
  89.   mov cs:[old_dos_seg],es
  90.  
  91. ; install new DOS ISR
  92.  
  93.   xor ax,ax ; zero ES register
  94.   mov es,ax
  95.   mov dx,offset new_dos ; point to start of program
  96.  
  97.   cli
  98.   mov word ptr es:[84],dx ; update vector offset
  99.   mov word ptr es:[86],cs ; update vector segment
  100.   sti
  101.  
  102. ; free memory used by environment block
  103.  
  104.   mov ah,62h ; get address of PSP
  105.   int 21h
  106.  
  107.   mov es,bx ; get address of environment block from PSP
  108.   mov bx,word ptr es:[2ch]
  109.  
  110.   mov es,bx ; free environment block
  111.   mov ah,49h
  112.   int 21h
  113.  
  114. ; display message
  115.  
  116.   push cs ; point ds at code segment
  117.   pop ds
  118.   mov dx,offset message ; point to message
  119.   mov ah,9
  120.   int 21h ; display message
  121.  
  122. ; TSR !
  123.  
  124.   mov dx,offset tsr_end ; length of resident portion
  125.   int 27h
  126.  
  127. message db 0ah,0dh,'NO_MD_RD.COM   Copyright (C) 1993 by Rafe Aldridge.',0ah,0dh,'The DOS functions to make and remove directories have been disabled.',0ah,0dh,24h
  128.  
  129. code ends
  130.   end start
  131.